package com.zzyl.mapper;


import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingProjectMapper {
    int insert(NursingProject nursingProject);
    int update(NursingProject nursingProject);
    int delete(Long id);
    NursingProject selectById(Long id);
    List<NursingProject> selectAll();

    Page<NursingProjectVo> pageQuery(@Param("name") String name, @Param("status") Integer status);

    @Select("select count(*) from nursing_project where name=#{name}")
    Integer selectByName(String name);

    @Select("select count(*) from nursing_project where name=#{name} and id!=#{id} ")
    Integer selectByNameForUpdate(String name, Long id);

    @Update("update nursing_project set status =#{status}  where id=#{id} ;")
    void updateStatus(@Param("id") Long id,@Param("status") Integer status);
}